package springBoot_dzfpxt.service;

import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import springBoot_dzfpxt.entity.QuanxianTable;
import springBoot_dzfpxt.rpository.QuanxianTableRepository;

@Service
public class QuanxianTableService {
	
	@Autowired
	private QuanxianTableRepository quanxianDAO;

	public Page<QuanxianTable> findAll(Pageable pageable) {
		return quanxianDAO.findAll(pageable);
	}

	public Page<QuanxianTable> findAll(Specification buildSpec, Pageable pageable) {
		return quanxianDAO.findAll(buildSpec,pageable);
	}

	public void save(QuanxianTable table) {
		// TODO Auto-generated method stub
		quanxianDAO.save(table);
	}

	public void deleteById(int id) {
		// TODO Auto-generated method stub
		quanxianDAO.deleteById(id);
	}

	public QuanxianTable findById(int id) {
		// TODO Auto-generated method stub
		Optional<QuanxianTable> optional = quanxianDAO.findById(id);
		if(optional.isPresent()) {
			return optional.get();
		}
		return null;
	}

}
